From a1b3d153425f8c66391698e0c43e6bf33a2b18d8 Mon Sep 17 00:00:00 2001 From: "leonardo.yvens" Date: Sat, 12 Dec 2015 16:19:11 -0200 Subject: [PATCH] clippy run --- src/bin/cargo.rs | 10 ++++------ src/bin/doc.rs | 5 ++--- src/bin/git_checkout.rs | 2 +- src/bin/read_manifest.rs | 2 +- src/bin/rustdoc.rs | 5 ++--- tests/support/paths.rs | 1 - 6 files changed, 10 insertions(+), 15 deletions(-) diff --git a/src/bin/cargo.rs b/src/bin/cargo.rs index d3ac5f71a..cd4e7204a 100644 --- a/src/bin/cargo.rs +++ b/src/bin/cargo.rs @@ -131,10 +131,8 @@ fn execute(flags: Flags, config: &Config) -> CliResult> { // For `cargo help foo`, print out the usage message for the specified // subcommand by executing the command with the `-h` flag. - "help" => { - vec!["cargo".to_string(), flags.arg_args[0].clone(), - "-h".to_string()] - } + "help" => vec!["cargo".to_string(), flags.arg_args[0].clone(), + "-h".to_string()], // For all other invocations, we're of the form `cargo foo args...`. We // use the exact environment arguments to preserve tokens like `--` for @@ -168,7 +166,7 @@ fn find_closest(config: &Config, cmd: &str) -> Option { .filter(|&(d, _)| d < 4) .collect::>(); filtered.sort_by(|a, b| a.0.cmp(&b.0)); - filtered.get(0).map(|slot| slot.1.to_string()) + filtered.get(0).map(|slot| slot.1.clone()) } fn execute_subcommand(config: &Config, @@ -245,7 +243,7 @@ fn search_directories(config: &Config) -> Vec { if let Some(val) = env::var_os("PATH") { dirs.extend(env::split_paths(&val)); } - return dirs + dirs } fn init_git_transports(config: &Config) { diff --git a/src/bin/doc.rs b/src/bin/doc.rs index 17f273451..f75ac8331 100644 --- a/src/bin/doc.rs +++ b/src/bin/doc.rs @@ -54,7 +54,7 @@ pub fn execute(options: Options, config: &Config) -> CliResult> { let root = try!(find_root_manifest_for_wd(options.flag_manifest_path, config.cwd())); - let mut doc_opts = ops::DocOptions { + let doc_opts = ops::DocOptions { open_result: options.flag_open, compile_opts: ops::CompileOptions { config: config, @@ -74,10 +74,9 @@ pub fn execute(options: Options, config: &Config) -> CliResult> { }, }; - try!(ops::doc(&root, &mut doc_opts).map_err(|err| { + try!(ops::doc(&root, &doc_opts).map_err(|err| { CliError::from_boxed(err, 101) })); Ok(None) } - diff --git a/src/bin/git_checkout.rs b/src/bin/git_checkout.rs index ff4d5f4c4..42b6562af 100644 --- a/src/bin/git_checkout.rs +++ b/src/bin/git_checkout.rs @@ -34,7 +34,7 @@ pub fn execute(options: Options, config: &Config) -> CliResult> { }) .map_err(|e| CliError::from_boxed(e, 1))); - let reference = GitReference::Branch(reference.to_string()); + let reference = GitReference::Branch(reference.clone()); let source_id = SourceId::for_git(&url, reference); let mut source = GitSource::new(&source_id, config); diff --git a/src/bin/read_manifest.rs b/src/bin/read_manifest.rs index b25eedb0e..8fa60b646 100644 --- a/src/bin/read_manifest.rs +++ b/src/bin/read_manifest.rs @@ -38,6 +38,6 @@ pub fn execute(options: Options, config: &Config) -> CliResult> try!(source.update().map_err(|err| CliError::new(err.description(), 1))); source.root_package() - .map(|pkg| Some(pkg)) + .map(Some) .map_err(|err| CliError::from_boxed(err, 1)) } diff --git a/src/bin/rustdoc.rs b/src/bin/rustdoc.rs index 5a33cb120..01a8307c4 100644 --- a/src/bin/rustdoc.rs +++ b/src/bin/rustdoc.rs @@ -68,7 +68,7 @@ pub fn execute(options: Options, config: &Config) -> CliResult> { let root = try!(find_root_manifest_for_wd(options.flag_manifest_path, config.cwd())); - let mut doc_opts = ops::DocOptions { + let doc_opts = ops::DocOptions { open_result: options.flag_open, compile_opts: ops::CompileOptions { config: config, @@ -90,8 +90,7 @@ pub fn execute(options: Options, config: &Config) -> CliResult> { }, }; - try!(ops::doc(&root, &mut doc_opts)); + try!(ops::doc(&root, &doc_opts)); Ok(None) } - diff --git a/tests/support/paths.rs b/tests/support/paths.rs index 57f59d712..2a25d93b1 100644 --- a/tests/support/paths.rs +++ b/tests/support/paths.rs @@ -1,6 +1,5 @@ use std::env; use std::fs; -use std::io::prelude::*; use std::io::{self, ErrorKind}; use std::path::{Path, PathBuf}; use std::sync::{Once, ONCE_INIT}; -- 2.30.2